package com.timothy.android.answer;

import com.timothy.android.BaseProcessActivity;
import com.timothy.android.R;
import com.timothy.android.R.id;
import com.timothy.android.R.layout;
import com.timothy.question.BaseQuestion;
import com.timothy.question.QuestionBuilder;
import com.timothy.statistics.SlideStatistics;
import com.timothy.statistics.StatisticsBuilder;

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
//import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;

public class SlideAnswerActivity extends BaseProcessActivity {
	private static final String LOG_TAG = "StatisticsSlideActivity";
//	private LinearLayout layoutStatisticsSlide;
	
	private TableLayout tableLayout1;
	private TextView totalTV,totalDescTV;
	private TextView averageTV,averageDescTV;
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.statistics_slide);

        Bundle bundle = this.getIntent().getExtras();
        String message = bundle.getString("message");
        Log.i(LOG_TAG, "message:"+message);
        
        SlideStatistics slide = StatisticsBuilder.parseSlideStatistics(message);
        BaseQuestion bq = slide.getQuestion();
        
//        //set title
        this.setTitle("(SlideIndex:"+bq.getSlideIndex()+")");
        
//        //set layout
//        layoutSlider = (LinearLayout) this.findViewById(R.id.layoutSlider);
 
//      //set tableLayout
        tableLayout1 = (TableLayout) this.findViewById(R.id.tableLayout1);
        tableLayout1.setBackgroundColor(Color.parseColor("#bd63ed"));
        
//		//set total
        totalDescTV = (TextView) this.findViewById(R.id.totalDescTV);
        totalDescTV.setTextSize(30);
 
        totalTV = (TextView) this.findViewById(R.id.totalTV);
        totalTV.setTextSize(30);
        totalTV.setText(String.valueOf(slide.getTotal()));
        
//        //set average
        averageDescTV = (TextView) this.findViewById(R.id.averageDescTV);
        averageDescTV.setTextSize(30);

        averageTV = (TextView) this.findViewById(R.id.averageTV);
        averageTV.setTextSize(30);
        averageTV.setText(String.valueOf(slide.getAverage()));
        
    }
}
